<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>错误 - 学生通讯录系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
    <style>
        .error-message {
            background-color: #f8d7da;
            color: #721c24;
            padding: 15px;
            margin-bottom: 20px;
            border: 1px solid #f5c6cb;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>学生通讯录系统</h1>
        </header>

        <nav>
            <ul>
                <li><a href="${pageContext.request.contextPath}/listContacts">查看所有联系人</a></li>
                <li><a href="${pageContext.request.contextPath}/addContact">添加联系人</a></li>
                <li><a href="${pageContext.request.contextPath}/index.jsp">返回首页</a></li>
                <li><a href="${pageContext.request.contextPath}/saveContactsToFile">导出到文件</a></li>
                <li><a href="${pageContext.request.contextPath}/loadContactsFromFile">从文件导入</a></li>
            </ul>
        </nav>

        <main>
            <section>
                <h2>操作出错</h2>
                
                <div class="error-message">
                    <p>${message != null ? message : '发生未知错误，请稍后重试。'}</p>
                </div>
                
                <div class="actions">
                    <a href="${pageContext.request.contextPath}/listContacts" class="btn">返回联系人列表</a>
                    <a href="${pageContext.request.contextPath}/index.jsp" class="btn">返回首页</a>
                </div>
            </section>
        </main>

        <footer>
            <p>2025 学生通讯录系统 - 南昌大学共青学院</p>
        </footer>
    </div>
</body>
</html>